package com.wanxi.method;

public class MaxArray {
    public static void main(String[] args) {
//        int[] arr = {132, 232, 4, 54, 6, 7};
        String name="";
        int max = maxArray(name,11, 23, 5, 65, 6, 7, 435, 436, 455, 57, 56, 8);
        System.out.println(max);
    }

    /**
     * 不定参数个数
     *
     * @param arr
     * @return
     */
    private static int maxArray(String name,int... arr) {
        System.out.println(name);
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        return max;
    }
}
